package com.lkxicy.wos.mapper;

import com.lkxicy.wos.pojo.entity.SalaryReword;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lkxicy
 * @since 2020-12-02
 */
public interface SalaryRewordMapper extends BaseMapper<SalaryReword> {

    @Select("select details from salaryReword where staffNumber=#{staffNumber} and month(effectTime)=month(#{effectTime})")
    public List<String> findDetails(String staffNumber,Date effectTime);

    @Insert("insert into salaryReword (staffNumber,details,salaryChange,effectTime)" +
            " values(#{staffNumber},#{details},#{salaryChange},#{effectTime})")
    public void changeSalary(@Param("staffNumber") String staffNumber, @Param("details") String details,
                             @Param("salaryChange") double salaryChange, @Param("effectTime") Date effectTime);

    @Select("select salaryChange from salaryReword where staffNumber=#{staffNumber} and month(effectTime)=month(#{effectTime})")
    public List<Double> findOneSalaryReword(String staffNumber,Date effectTime);

    @Select("select * from salaryReword where staffNumber=#{staffNumber}")
    public List<SalaryReword> findOneAllReword(@Param("staffNumber") String staffNumber);

}
